package team.seekers.hula.common.entity.enums.todo;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * todo状态枚举
 */
@Getter
public enum TodoTypeEnum implements IEnum<Integer> {

    NORMAL(0, "普通待办"),
    TEAM(1, "团队待办"),
    TEAM_MONITOR(2, "负责待办"),
    ORDER(3, "决策待办"),
    GOAL(4, "目标待办");

    private int type;

    private String name;

    TodoTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static TodoTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static TodoTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
